<?php
	//<magic>
	$left = 280 - ($cur_tab - 1)*111;
	$left = ($left > 0) ? 0 : $left;
	$d = 600 - (count($list_tabs)*111 + $left);
	if ($d > 0) {
		$left += $d;
		$left = ($left > 0) ? 0 : $left;
	}
	//</magic>
?>
<div id="tabs-contaner" style="<?php if (count($list_tabs)*111 + $left < 600) echo 'border-right: 0px;width:600px;' ?>">
	<table cellspacing="0" id="tabs" style="<?php echo $html->style(array('left' => $left.'px')); ?>">
	<tr>
		<?php foreach ($list_tabs as $position => $label) : ?>
			<?php if ($position == $cur_tab) : ?>
				<td class="tab-current">
					<span id="tab">
						<?php echo $this->element('control_tab', array('position' => $position, 'label' => $label, 'list_tabs' => $list_tabs)); ?>
						<div title="<?php echo $label; ?>"><?php echo str_replace(" ", "&nbsp;", $label); ?></div>
					</span>
				</td>
			<?php else : ?>
				<td class="tab" title="<?php echo $label; ?>">
					<?php echo $html->link("<div>".str_replace(" ", "&nbsp;", $label)."</div>", array(
							'controller' => 'tabs',
							'action' => 'index',
							$position
							),
							array('escape'=>false));
					?>
				</td>
			<?php endif; ?>
		<?php endforeach; ?>
	</tr>
	</table>
</div>